import copy

class Foo():

    def __init__(self,orig=None):

        self.lista = []
        
        if (orig==None):
            self.non_copy_constructor()
        else:
            self.copy_constructor(orig)
    def non_copy_constructor(self):
        print ("non copy constructor")
        # do the non-copy constructor stuff
    def copy_constructor(self,orig):

        #create list base on orig list, not reference!!!
        self.lista = copy.copy(orig.lista)
        print ("copy constructor")

    
a=Foo()  # this will call the non-copy constructor
a.lista.append(20)

print (a.lista)

c = Foo(a)

print (c.lista)
a.lista.append(50)

print (c.lista)
print (a.lista)





 

